home *** CD-ROM | disk | FTP | other *** search
- unit UTstDate;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls;
-
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- ComboBox1: TComboBox;
- ComboBox2: TComboBox;
- ComboBox3: TComboBox;
- ComboBox4: TComboBox;
- Label2: TLabel;
- Button1: TButton;
- Label3: TLabel;
- Label4: TLabel;
- procedure FormCreate(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- uses
- AACDate;
-
- {$R *.DFM}
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- ComboBox1.ItemIndex := 0;
- ComboBox2.ItemIndex := 0;
- ComboBox3.ItemIndex := 0;
- ComboBox4.ItemIndex := 0;
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- var
- Day : integer;
- Month : integer;
- Year : integer;
- WhichOne : integer;
- Date : TDateTime;
- Week : integer;
- begin
- Day := ComboBox2.ItemIndex + 1;
- Month := ComboBox1.ItemIndex + 1;
- Year := ComboBox4.ItemIndex + 1980;
- WhichOne := ComboBox3.ItemIndex + 1;
- Date := GetDateForDayOfMonth(WhichOne, Day, Month, Year);
- if Date = 0.0 then
- Label3.Caption := 'no such day'
- else begin
- Label3.Caption := DateToStr(Date);
- GetISODate(Date, Year, Week, Day);
- Label4.Caption := Format('Week %d, Day %d, %d', [Week, Day, Year]);
- end;
- end;
-
- end.
-